using System;
using DC2010.Objects;
using DC2010.Objects.Base;
using DC2010.Objects.Data;

namespace DC2010.Effects
{
   
    public class I_Eat_Effect : EffectLogic
    {
        public I_Eat_Effect(EffectData ed) : base(ed)
        {
            ShortName = "EAT";
            LongName = "Effect increases/decreses food value for creature.";
            Id = "I_EAT_EFFECT";
            EffectType = EffectType.Instant;
        }

        public override void Instant(BaseObject aInvoker, BaseObject aTarget)
        {
            if (aInvoker is CreatureData)
            {
                CreatureData c = (CreatureData)aInvoker;

                string pAmount = Data.Params.Find(A => A.Key == "AMOUNT").Value;
                string pDirection = Data.Params.Find(A => A.Key == "DIRECTION").Value;
                int Amount;
                Int32.TryParse(pAmount, out Amount);

                if (pDirection == "-")
                    c.Attributes.Food.Incr(-Amount);
                else
                    c.Attributes.Food.Incr(Amount);
            }

            base.Instant(aInvoker, aTarget);
        }
    }
}

